package com.imooc.scala.course06

import scala.util.Random


/**
  * 被包在花括号内没有match的一组case语句
  */
object PartitalFunctionApp {
  def main(args: Array[String]): Unit = {
    val names = Array("Akiho Yoshizawa", "YuiHatana", "Aoi Sola")
    val name = names(Random.nextInt(names.length))

    name match {
      case "Akiho Yoshizawa" => println("吉老师...")
      case "YuiHatana" => println("波老师...")
      case _ => println("真不知道你们在说什么啊 ， 我很纯洁啊")
    }

    //A输入参数类型   B输出参数类型
    def sayChinese:PartialFunction[String, String] = {
      case "Akiho Yoshizawa" => "吉老师..."
      case "YuiHatana" => "波老师"
      case _ => "真不知道你们在说什么..."
    }

    println(sayChinese("Akiho Yoshizawa"))

  }

}
